package com.beifeng.secondsort;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class MySecondSortPartition extends Partitioner<SecondKey, NullWritable>{
	@Override
	public int getPartition(SecondKey key, NullWritable value, int numPartitions) {
		System.out.println("=============");
		System.out.println("进入到自定义的分区方法中");
		System.out.println("=============");
		if(key.getYear()==1999){
			return 0;
		}
		if(key.getYear()==2000){
			return 1;
		}
		if(key.getYear()==2001){
			return 2;
		}
		return 0;
	}

}
